package com.litchishell.ssmdemo.aspect;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

/**
 * @author LitchiShell
 * @description: 实现环绕通知的切面类
 * @create 2022-04-16
 */
public class MyAopAspect implements MethodInterceptor {
    @Override
    public Object invoke(MethodInvocation invocation) throws Throwable {
        checkPermission();
        // 执行目标方法
        Object proceed = invocation.proceed();
        log();
        return proceed;
    }
    public void checkPermission() {
        System.out.println("权限检查....");
    }

    public void log() {
        System.out.println("记录日志....");
    }
}
